const {Sequelize,DataTypes,Op} = require('sequelize')
const sequelize = new Sequelize('text','postgres','zyfyyds',{
    host:'zyfyyds.top',
    dialect:'postgres'
})

let modelobj = {}

modelobj['Produces'] = sequelize.define('produces',{
    name:{
        type:DataTypes.STRING,
        allowNull:false
    },
    price:{
        type:DataTypes.DECIMAL,
        allowNull:false
    },
    stock:{
        type:DataTypes.INTEGER,
        allowNull:false
    }
})

modelobj.sync = async ()=>{
    await sequelize.sync({force:true})
    modelobj.Produces.bulkCreate([
        {
            name:'Soul',
            price:12.12,
            stock:1
        },
        {
            name:'S',
            price:12.12,
            stock:111
        },
        {
            name:'S',
            price:12.12,
            stock:122
        }
    ])
}
modelobj.Op = Op;

module.exports = modelobj;